/*--------------------------------------------------------------------------
  Project::HEXAGON FLIGHT SIMULATOR
  Package::Camera
  Class::Camera
  File Camera.h
  --------------------------------------------------------------------------
  * METHODS AND CLASS PARAMETERS


  --------------------------------------------------------------------------
  * FUNCTIONS DESCRIPTION
  

  --------------------------------------------------------------------------
  * COPYRIGHT

  --------------------------------------------------------------------------
  * INFO ABOUT AUTHOR AND VERSIONS
  Author:	Tino Giorgio	Data: 
  Rev1:			Data:

  --------------------------------------------------------------------------
  * E-MAIL & CONTACTS

  GIORGIO TINO:	tinoshi@libero.it
	           	shapeofangels@hotmail.com
	            giorgio.tino@studenti.polito.it

  --------------------------------------------------------------------------*/


#if !defined(CAMERA_H)
#define CAMERA_H

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

/* PLIB includes*/
#include <plib/fnt.h>
#include <plib/ul.h>
#include <plib/pw.h>
#include <plib/pu.h>
#include <plib/sg.h>
#include <plib/ssg.h>

/* Project classes includes */
#include "Defines.h"

#define CAMERA_START_POSITION_X   0.0f
#define CAMERA_START_POSITION_Y   0.0f
#define CAMERA_START_POSITION_Z   2500.0f
#define CAMERA_START_POSITION_H   0.0f
#define CAMERA_START_POSITION_P   -30.0f
#define CAMERA_START_POSITION_R   0.0f

#define CAMERA_DISTANCE_RADIUS     2500.0f
#define CAMERA_DISTANCE_INCREMENT      100.0f
#define CAMERA_ROT_INCREMENT		   1.0f
#define CAMERA_ELEV_INCREMENT		   1.0f
#define CAMERA_SPEED				   20.0f

#define CAMERA_MAX_DISTANCE        100000.0f
#define CAMERA_MIN_DISTANCE            10.0f

#define STRIFE_ANGLE 90.0f

#define MIN_HOT 2.0f

#define HORIZONTAL_FOV 20.0f
#define VERTICAL_FOV   15.0f
#define CAMERA_NEAR    1.0f
#define CAMERA_FAR     200000.0f

#define ROTATE_LEFT		 0
#define ROTATE_RIGHT	1
#define PITCH_UP		2
#define PITCH_DOWN		3
#define ZOOM_IN			4
#define ZOOM_OUT		5
#define TURN_LEFT		6
#define TURN_RIGHT		7
#define LOOK_UP			8
#define LOOK_DOWN		9
#define GO_UP			10
#define GO_DOWN			11
#define GO_AHEAD		12
#define RESET			13
#define GO_BACKWARDS    14
#define STRIFE_LEFT		15
#define STRIFE_RIGHT	16 

#define FREE_MOVE  0
#define MOVIE_MOVE 1
#define VIEW_MOVIE 2

class Camera  
{
public:
	Camera();
	virtual ~Camera();

	sgCoord* getCameraPosition();
	sgCoord* getMoviePosition();

	void setCameraPosition(sgCoord new_position);
	void setMoviePosition(sgCoord new_position);
	void setFilmPosition(sgCoord* new_position);

	void move(int mov, float hot);
	float getRadius();

	void switchToEditingView();
	void switchToCameraRepositioningView();
	void switchToMovieView();

private:
	void freeMove(int mov, float hot);
	void movieMove(int mov, float hot);

	/* The nnext two sgCoord are needed to set up the camera in TERRAIN_MODE */
	sgCoord cameraPosition;
	sgCoord moviePosition;
	sgCoord filmPosition;
	sgFloat cameraDistance;

	int inner_state;
};

#endif // !defined(CAMERA_H)
